package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortPoint {
    public static void main(String[] args) {
        List<Point> list = new ArrayList<>();
        list.add(new Point(1,2));
        list.add(new Point(3,4));
        list.add(new Point(5,6));
        list.add(new Point(7,8));
        list.add(new Point(9,10));
        System.out.println("list的原始数据:"+list);
        Collections.sort(list, (o1,o2) -> o1.getX()-o2.getX());
        System.out.println(list);
    }
}
